package com.micro.ai.commons.constant;

/**
 * HTTP 相关常量定义
 * 
 * @author micro-ai
 * @since 0.0.1
 */
public final class HttpConstants {

    private HttpConstants() {
        // 工具类不允许实例化
    }

    /**
     * HTTP 状态码
     */
    public static final class Status {
        public static final int OK = 200;
        public static final int CREATED = 201;
        public static final int NO_CONTENT = 204;
        public static final int BAD_REQUEST = 400;
        public static final int UNAUTHORIZED = 401;
        public static final int FORBIDDEN = 403;
        public static final int NOT_FOUND = 404;
        public static final int METHOD_NOT_ALLOWED = 405;
        public static final int CONFLICT = 409;
        public static final int UNPROCESSABLE_ENTITY = 422;
        public static final int TOO_MANY_REQUESTS = 429;
        public static final int INTERNAL_SERVER_ERROR = 500;
        public static final int BAD_GATEWAY = 502;
        public static final int SERVICE_UNAVAILABLE = 503;
        public static final int GATEWAY_TIMEOUT = 504;
    }

    /**
     * HTTP 方法
     */
    public static final class Method {
        public static final String GET = "GET";
        public static final String POST = "POST";
        public static final String PUT = "PUT";
        public static final String DELETE = "DELETE";
        public static final String PATCH = "PATCH";
        public static final String HEAD = "HEAD";
        public static final String OPTIONS = "OPTIONS";
    }

    /**
     * HTTP 头名称
     */
    public static final class Header {
        public static final String CONTENT_TYPE = "Content-Type";
        public static final String CONTENT_LENGTH = "Content-Length";
        public static final String AUTHORIZATION = "Authorization";
        public static final String USER_AGENT = "User-Agent";
        public static final String ACCEPT = "Accept";
        public static final String ACCEPT_LANGUAGE = "Accept-Language";
        public static final String ACCEPT_ENCODING = "Accept-Encoding";
        public static final String CACHE_CONTROL = "Cache-Control";
        public static final String CONNECTION = "Connection";
        public static final String HOST = "Host";
        public static final String REFERER = "Referer";
        public static final String X_FORWARDED_FOR = "X-Forwarded-For";
        public static final String X_REAL_IP = "X-Real-IP";
        public static final String X_REQUEST_ID = "X-Request-Id";
        public static final String X_USER_ID = "X-User-Id";
        public static final String X_TENANT_ID = "X-Tenant-Id";
    }

    /**
     * Content-Type 值
     */
    public static final class ContentType {
        public static final String APPLICATION_JSON = "application/json";
        public static final String APPLICATION_XML = "application/xml";
        public static final String TEXT_PLAIN = "text/plain";
        public static final String TEXT_HTML = "text/html";
        public static final String MULTIPART_FORM_DATA = "multipart/form-data";
        public static final String APPLICATION_FORM_URLENCODED = "application/x-www-form-urlencoded";
        public static final String APPLICATION_OCTET_STREAM = "application/octet-stream";
    }

    /**
     * 字符编码
     */
    public static final class Charset {
        public static final String UTF_8 = "UTF-8";
        public static final String ISO_8859_1 = "ISO-8859-1";
        public static final String GBK = "GBK";
        public static final String GB2312 = "GB2312";
    }
}
